#include "common.h"
struct v2p {
half2 tc0:TEXCOORD0;
half2 tc1:TEXCOORD1;
half2 tc2:TEXCOORD2;
half3 tc3:TEXCOORD3;
half3 c0:COLOR0;
half3 c1:COLOR1;
};
uniform samplerCUBE s_env;
half4 main_ps_2_0(v2p I):COLOR {
half4 t_base=tex2D(s_base,I.tc0);
half4 t_lmap=tex2D(s_lmap,I.tc1);
half4 t_env=texCUBE(s_env,I.tc3);
half3 l_base=t_lmap.rgb;
half3 l_hemi=I.c0*p_hemi(I.tc2);
half3 l_sun=I.c1*t_lmap.a;
half3 light=L_ambient+l_base+l_sun+l_hemi;
half3 base=lerp(t_env,t_base,t_base.a);
half3 final=light*base*2;
return half4(final.r,final.g,final.b,t_base.a);
}